package com.wjs.blog.controller;

import com.wjs.blog.service.CategoryService;
import com.wjs.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/categorys")
public class CategoryControl {
    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public Result categories() {
        return categoryService.findall();
    }
    @GetMapping("/detail")
    public Result categoriesDetail() {
        return categoryService.findallDetail();
    }
    @GetMapping("/detail/{id}")
    public Result categoryDetailById(@PathVariable("id") long id) {
        return categoryService.categoryDetailById(id);
    }

}
